const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    isLogin:false,
    Hy:[],
    IsUse:1,
    RankName:'免费会员',
    UPic:'',
    hyfwjg:0,
    isFree:1,
    winHeight:555,
    nav:[{img:'../../images/hy_icon_sd.png',name:'我的锁定',url:'wodesuoding'},{img:'../../images/hy_icon_ck.png',name:'查看记录',url:'chakanjilu'},{img:'../../images/hy_icon_sj.png',name:'升级会员',url:'shengjihuiyuan'},{img:'../../images/hy_icon_xg.png',name:'相关认证',url:'xiangguanrenzheng'},{img:'../../images/hy_icon_g.png',name:'购买关键词',url:'goumaikey'}]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      winHeight:wx.getSystemInfoSync().windowHeight+'px'
    })
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.setData({
      isLogin:app.checkFjLogin()
    })
    if (app.checkFjLogin()) {
      this.getFeijiu_GetUserFwList();
    }
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },
  //api/FeijiuApp/Feijiu_GetUserFwList
  getFeijiu_GetUserFwList:function () {
    var that = this;    
    var FjLoginLog = wx.getStorageSync('FjLoginLog');
    var api_input = {
      uid:FjLoginLog.UID 
    } 
    app.getDaoPostN('api/FeijiuApp/Feijiu_GetUserFwList',api_input,function (r) {
      if (r.code == 200) {
        var myArray=[];
        var hylist = r.data.Hy.split(',');
        for (var i = 0; i < hylist.length; i++) {
          var obj = {
            id:hylist[i].substr(-6,2),
            imgurl:hylist[i],
          }
          myArray.push(obj)
        }        
        that.setData({
          Hy:myArray,
          IsUse:r.data.IsUse,
          RankName:r.data.RankName,
          UPic:r.data.UPic,
          hyfwjg:r.data.hyfwjg,
          isFree:r.data.isFree
        })
      }
    }) 
  },
  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },
  toCompany:function (e) {    
    wx.navigateTo({
      url: 'buyhuiyuan?id='+e.currentTarget.dataset.id
    })
  },
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  toLogin:function () {    
    wx.navigateTo({ url: '../../pages/login/index' });  
  },

  tolist:function (e) {
    var url = e.currentTarget.dataset.url;
      wx.navigateTo({
        url: url
      })
  }

})